<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/2 0002
 * Time: 上午 9:23
 */

//基类

//if(!define('BASEPATH')) exit('Error:No direct script access allowed;');
class MY_Model extends CI_Model{

    public function __construct()
    {
        parent::__construct();
       // echo $this->c = $this->router->fetch_class();
    }


}

class Admin_Model extends MY_Model{

    public function __construct()
    {
        parent::__construct();
       //

    }


    protected function getPageinate($url,$total,$pagesize,$uri_segment,$attributes=array()){

        $this->load->library('pagination');
        $config['base_url'] = $url;
        $config['total_rows'] = $total;
        $config['per_page'] = $pagesize;
        $config['first_link'] = '首页';
        $config['last_link'] = '尾页';
        $config['next_link'] = '下一页';
        $config['prev_link'] = '上一页';
        $config['num_links'] = 2;
       if(is_array($attributes) && count($attributes)>0) {

           $config['suffix'] = "?".http_build_query($attributes);
       }
        $config['uri_segment'] =$uri_segment;
        $limit = $config['per_page'];
        $offset = $this->uri->segment($uri_segment);
        $this->pagination->initialize($config);
        $page =  $this->pagination->create_links();

        return ['limit'=>$limit,'offset'=>$offset,'page'=>$page];


    }





}